package com.jiaai.web.zfp_back.live;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.live.api.ILiveTypeApi;
import com.jiaai.live.model.LiveTypeVO;
import com.jiaai.util.RestResultGenerator;
import org.springframework.web.bind.annotation.*;

/**
 * class_name:ZBLiveTypeController
 * describe:TODO
 * create_user:张昉平
 * create_date:2018/1/4
 * create_date:9:45
 */
@RestController
@RequestMapping("/api/v1/admin/livetype")
public class ZBLiveTypeController {

    @Reference
    private ILiveTypeApi iLiveTypeApi;

    @GetMapping("/list")
    public Object list(){
        return RestResultGenerator.genSuccessResult(iLiveTypeApi.getAll());
    }

    @PostMapping("/saveoredit")
    public Object saveOrEdit(@RequestBody LiveTypeVO liveTypeVO){
        iLiveTypeApi.saveOrEdit(liveTypeVO);
        return RestResultGenerator.genSuccessResult("操作成功");
    }

    @PostMapping("/delete/{id}/{flag}")
    public Object saveOrEdit(@PathVariable("id") Integer id, @PathVariable("flag") Integer flag){
        iLiveTypeApi.delete(id, flag);
        return RestResultGenerator.genSuccessResult("操作成功");
    }

}
